#set( $layout = "include/header_footer.html" )
#set( $page_title = "登录" )
<div align="center">
    <div style="display: inline-block; border: 1px solid #e7e7e7; margin-top: 20px; padding-bottom: 40px;width: 420px;" align="left">
        <form  method="post">

            <div style="height: 30px; background-color: fd5c63; color: white; padding: 10px 0px 10px 20px; font-size: 20px;">管理员登录</div>
            <div style="padding-left: 40px; padding-right: 40px;">
                <div style="height: 40px; margin-top: 40px;">
                    <input type="text" placeholder="请输入账号" style="width: 100%; height: 40px;"  name="accountNo" id="accountNo" >
                </div>
                <div style="height: 40px; margin-top: 40px;">
                    <input type="password" placeholder="请输入密码" style="width: 100%; height: 40px;" name="pwd" id="pwd">
                </div>


                <div style="height: 40px; margin-top: 15px;">
                    <input type="text" placeholder="请输入验证码" style="height: 40px;" name="imageCheckCode" id="imageCheckCode"  maxlength="4">
                    <img id="imgCode" src="$!{velocityCommonUtil.getAbsoluteURL()}/imageCheckCode.html" style="height: 40px;vertical-align: middle;cursor: pointer;"  onclick="this.src='$!{velocityCommonUtil.getAbsoluteURL()}/imageCheckCode.html?t=' + new Date().getTime()" >
                </div>


                <div style="height: 40px; margin-top: 40px;">
                    <input type="button" enter="true" id="btnLogin" class="btn   btn-danger"   value="登录" style="width: 100%; height: 40px;">
                </div>


            </div>
        </form>
    </div>
</div>
<script type="text/javascript" charset="utf-8" src="$!{velocityCommonUtil.getAbsoluteURL()}/_resources/js/md5.js"></script>
<script>
    $(document).ready(function(){
        $("#btnLogin").click(function(){
            //validate

            var accountNo = $("#accountNo").val();
            if(!accountNo){
                alert("请输入账号");
                $("#accountNo").focus();
                return;
            }
            var pwd = $("#pwd").val();
            if(!pwd){
                alert("请输入密码");
                $("#pwd").focus();
                return;
            }
            var imageCheckCode = $("#imageCheckCode").val();
            if(!imageCheckCode){
                alert("请输入验证码");
                $("#imageCheckCode").focus();
                return;
            }

            //do submit
            var url = basePath+"/login";
            var params = getFormParams();
            pwd = (CryptoJS.MD5(pwd) + "").toUpperCase();
            params["pwd"] = pwd;
            $.post(url,params,function(result){
                if(result.success){
                    window.location = basePath+"/";
                }else{
                    $("#imgCode").trigger("click");
                    alert(result.message);
                }
            });
        });
    });

</script>



